Add readonly properties min-position and max-position. (#58431, Padraig
authorMatthias Clasen <maclas@gmx.de>
Wed, 5 Nov 2003 20:15:19 +0000 (20:15 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 5 Nov 2003 20:15:19 +0000 (20:15 +0000)
Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
min-position and max-position.  (#58431, Padraig O'Briain)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkpaned.c

index 8d52ab3c082f9faa36082f626d62a9efe36185f9..f64e294c6a36d720906a85ca7cef088e962338ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+       min-position and max-position.  (#58431, Padraig O'Briain)
+
 Wed Nov  5 21:02:26 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcolorsel.c (update_color): 
index 8d52ab3c082f9faa36082f626d62a9efe36185f9..f64e294c6a36d720906a85ca7cef088e962338ea 100644 (file)
@@ -1,3 +1,8 @@
+Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+       min-position and max-position.  (#58431, Padraig O'Briain)
+
 Wed Nov  5 21:02:26 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcolorsel.c (update_color): 
index 8d52ab3c082f9faa36082f626d62a9efe36185f9..f64e294c6a36d720906a85ca7cef088e962338ea 100644 (file)
@@ -1,3 +1,8 @@
+Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+       min-position and max-position.  (#58431, Padraig O'Briain)
+
 Wed Nov  5 21:02:26 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcolorsel.c (update_color): 
index 8d52ab3c082f9faa36082f626d62a9efe36185f9..f64e294c6a36d720906a85ca7cef088e962338ea 100644 (file)
@@ -1,3 +1,8 @@
+Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+       min-position and max-position.  (#58431, Padraig O'Briain)
+
 Wed Nov  5 21:02:26 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcolorsel.c (update_color): 
index 8d52ab3c082f9faa36082f626d62a9efe36185f9..f64e294c6a36d720906a85ca7cef088e962338ea 100644 (file)
@@ -1,3 +1,8 @@
+Wed Nov  5 21:07:58 2003  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+       min-position and max-position.  (#58431, Padraig O'Briain)
+
 Wed Nov  5 21:02:26 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcolorsel.c (update_color): 
index c064d752e7073bd2671cedcc13f5f328dd8444b4..1561e46d64949214b2c406c12012f7ae6511ce1a 100644 (file)
@@ -36,7 +36,9 @@
 enum {
   PROP_0,
   PROP_POSITION,
-  PROP_POSITION_SET
+  PROP_POSITION_SET,
+  PROP_MIN_POSITION,
+  PROP_MAX_POSITION
 };
 
 enum {
@@ -255,6 +257,41 @@ gtk_paned_class_init (GtkPanedClass *class)
                                                             G_MAXINT,
                                                             5,
                                                             G_PARAM_READABLE));
+  /**
+   * GtkPaned:min-position:
+   *
+   * The smallest possible value for the position property. This property is derived from the
+   * size and shrinkability of the widget's children.
+   *
+   * Since: 2.4
+   */
+  g_object_class_install_property (object_class,
+                                  PROP_MIN_POSITION,
+                                  g_param_spec_int ("min_position",
+                                                    _("Minimal Position"),
+                                                    _("Smallest possible value for the \"position\" property"),
+                                                    0,
+                                                    G_MAXINT,
+                                                    0,
+                                                    G_PARAM_READABLE));
+
+  /**
+   * GtkPaned:max-position:
+   *
+   * The largest possible value for the position property. This property is derived from the
+   * size and shrinkability of the widget's children.
+   *
+   * Since: 2.4
+   */
+  g_object_class_install_property (object_class,
+                                  PROP_MIN_POSITION,
+                                  g_param_spec_int ("max_position",
+                                                    _("Maximal Position"),
+                                                    _("Largest possible value for the \"position\" property"),
+                                                    0,
+                                                    G_MAXINT,
+                                                    G_MAXINT,
+                                                    G_PARAM_READABLE));
 
 /**
  * GtkPaned:resize:
@@ -500,6 +537,12 @@ gtk_paned_get_property (GObject        *object,
     case PROP_POSITION_SET:
       g_value_set_boolean (value, paned->position_set);
       break;
+    case PROP_MIN_POSITION:
+      g_value_set_int (value, paned->min_position);
+      break;
+    case PROP_MAX_POSITION:
+      g_value_set_int (value, paned->max_position);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1090,10 +1133,14 @@ gtk_paned_compute_position (GtkPaned *paned,
                            gint      child2_req)
 {
   gint old_position;
+  gint old_min_position;
+  gint old_max_position;
   
   g_return_if_fail (GTK_IS_PANED (paned));
 
   old_position = paned->child1_size;
+  old_min_position = paned->min_position;
+  old_max_position = paned->max_position;
 
   paned->min_position = paned->child1_shrink ? 0 : child1_req;
 
@@ -1133,8 +1180,14 @@ gtk_paned_compute_position (GtkPaned *paned,
   gtk_widget_set_child_visible (paned->child1, paned->child1_size != 0);
   gtk_widget_set_child_visible (paned->child2, paned->child1_size != allocation);
 
+  g_object_freeze_notify (G_OBJECT (paned));
   if (paned->child1_size != old_position)
     g_object_notify (G_OBJECT (paned), "position");
+  if (paned->min_position != old_min_position)
+    g_object_notify (G_OBJECT (paned), "min_position");
+  if (paned->max_position != old_max_position)
+    g_object_notify (G_OBJECT (paned), "max_position");
+  g_object_thaw_notify (G_OBJECT (paned));
 
   paned->last_allocation = allocation;
 }